﻿namespace MongoDBController
{
    using System;
    using System.Linq;
    using MongoDB.Bson;
    using MongoDB.Bson.Serialization.Attributes;

    [Serializable]
    public class ProductReportJson
    {
        [BsonId]
        public ObjectId Id { get; set; }

        public int ProductId { get; set; }

        public string ProductName { get; set; }

        public string VendorName { get; set; }

        public int TotalQuantitySold { get; set; }

        public decimal TotalIncomes { get; set; }

        //[BsonConstructor]
        //public ProductReportJson(int productId, string productName, string vendorName, int totalSold, decimal totalIncome)
        //{
        //    this.ProductId = productId;
        //    this.ProductName = productName;
        //    this.VendorName = vendorName;
        //    this.TotalQuantitySold = totalSold;
        //    this.TotalIncomes = totalIncome;
        //}

        public override string ToString()
        {
            var productReportAsString = string.Format(
                "Product ID: {0}, Product name: {1}, Vendor Name: {2}, Total quantity sold: {3}, Total Incomes: {4}.",
                this.ProductId, 
                this.ProductName, 
                this.VendorName, 
                this.TotalQuantitySold, 
                this.TotalIncomes);

            return productReportAsString;
        }
    }
}
